﻿using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;

namespace ProductTool.Tools
{
    class Common
    {
        public static string in_user { get; set; } = "Markin.Li(ml28)";

        /*         
         
            post http://centralapi.ecnow.tech/hub/admin/login
         
            {"email":"acro.chao","password":"acro.chao.123"}
             
         */

        public static string token = "eyJhdXRoIjoiYmEzYWNjMzJhYWUzMmVhNzRjNTkzNWY0OTMzNzBhOWYiLCJkYXRhIjoiMTAwMCIsImV4cCI6MTU3NjY4ODI4MiwiaXNMb2dpbiI6MSwic2FsdCI6IjkzMjEifQ==";

        public static string ec_token = "eyJhdXRoIjoiNTViMWQ4MTg4ZGJkOTc3MzZmYTMzOTUyMGU4NTYzOTgiLCJkYXRhIjoiMjI0MDgwMiIsImV4cCI6MTU5MTY2OTMyNCwiaXNMb2dpbiI6MSwic2FsdCI6Ijk0ODAifQ==";

        public static string MD5Encrypt(string strText)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] fromData = System.Text.Encoding.Unicode.GetBytes(strText);
            byte[] targetData = md5.ComputeHash(fromData);
            string byte2String = null;

            for (int i = 0; i < targetData.Length; i++)
            {
                byte2String += targetData[i].ToString("x");
            }
            return byte2String;
        }
    }
}
